﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ICM_Inventory_Stock_Taking.aspx.cs" Inherits="KPIS.GERP.GIMS.APP.APP_UI.Add_Form.ICM_Inventory_Stock_Taking" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <title>รายการแสดงการตรวจนับ</title>
    <link rel="StyleSheet" href="../../Styles/StyleSheet.css" type="text/css"/>
</head>
<body>
    <form id="form1" runat="server">
             <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" >
             </asp:ScriptManager>
             <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
                   <script type="text/javascript" src="../../Scripts/Common.js"></script>
                   <script type="text/javascript">
                   Sys.Application.add_load(setCalendarCheckStartDateTable);
                   Sys.Application.add_load(setCalendarCheckEndDateTable);
                //========================= Check Stock Start Date ============================//
                function setCalendarCheckStartDateTable() {
                    var tooltip = $find("<%= ToolTipCheckStartDateSystem.ClientID %>");
                    var calendar = $find("<%= CalendarCheckStartDateSystem.ClientID %>");                       
                    var fastNavigation = calendar._getFastNavigation();
                    fastNavigation.OnToday =
                    function()
                    {
                        var today = new Date;
                        var date = [today.getFullYear(), today.getMonth()+ 1, today.getDate()];
                        calendar.selectDate(date, true);
                        fastNavigation.Popup.Hide();  
                        var all_date = date.toString().split(",");
                        var year = parseInt(all_date[0]) + 543;
                        var month = all_date[1];
                        var day = all_date[2];
                        if (day.length == 1) {
                            day = '0' + day;
                        }
                        if (month.length == 1) {
                            month = '0' + month;
                        }

                        var maskText = $find("<%= txtCheckStartDate.ClientID %>");
                        maskText.set_value(day + month + year);
                        tooltip.hide();
                    }
                }
                function OnCheckStartDateClick(calendarInstance, args) {
                    var tooltip = $find("<%= ToolTipCheckStartDateSystem.ClientID %>");
                    var fastNavigation = calendarInstance._getFastNavigation();
                    var date = args.get_renderDay().get_date().toString();
                    var all_date = date.split(",");
                    var year = parseInt(all_date[0]) + 543;
                    var month = all_date[1];
                    var day = all_date[2];
                    if (day.length == 1) {
                        day = '0' + day;
                    }
                    if (month.length == 1) {
                        month = '0' + month;
                    }

                    var maskText = $find("<%= txtCheckStartDate.ClientID %>");
                    maskText.set_value(day + month + year);
                    tooltip.hide();
                }
                function OnCalendarCheckStartDateViewChanged(sender, step) {
                    var year = parseInt(sender.FocusedDate[0]) + 543;
                    var month = sender.FocusedDate[1];
                    document.getElementById("CalendarStockStartDateSystem_Title").innerHTML = changeMonthNumberToName(month) + " " + year; 
                }
                //========================= Check Stock End Date ============================//
                function setCalendarCheckEndDateTable() {
                    var tooltip = $find("<%= ToolTipCheckEndDateSystem.ClientID %>");
                    var calendar = $find("<%= CalendarCheckEndDateSystem.ClientID %>");                       
                    var fastNavigation = calendar._getFastNavigation();
                    fastNavigation.OnToday =
                    function()
                    {
                        var today = new Date;
                        var date = [today.getFullYear(), today.getMonth()+ 1, today.getDate()];
                        calendar.selectDate(date, true);
                        fastNavigation.Popup.Hide();  
                        var all_date = date.toString().split(",");
                        var year = parseInt(all_date[0]) + 543;
                        var month = all_date[1];
                        var day = all_date[2];
                        if (day.length == 1) {
                            day = '0' + day;
                        }
                        if (month.length == 1) {
                            month = '0' + month;
                        }

                        var maskText = $find("<%= txtCheckEndDate.ClientID %>");
                        maskText.set_value(day + month + year);
                        tooltip.hide();
                    }
                }
                function OnCheckEndDateClick(calendarInstance, args) {
                    var tooltip = $find("<%= ToolTipCheckEndDateSystem.ClientID %>");
                    var fastNavigation = calendarInstance._getFastNavigation();
                    var date = args.get_renderDay().get_date().toString();
                    var all_date = date.split(",");
                    var year = parseInt(all_date[0]) + 543;
                    var month = all_date[1];
                    var day = all_date[2];
                    if (day.length == 1) {
                        day = '0' + day;
                    }
                    if (month.length == 1) {
                        month = '0' + month;
                    }

                    var maskText = $find("<%= txtCheckEndDate.ClientID %>");
                    maskText.set_value(day + month + year);
                    tooltip.hide();
                }
                function OnCalendarCheckEndDateViewChanged(sender, step) {
                    var year = parseInt(sender.FocusedDate[0]) + 543;
                    var month = sender.FocusedDate[1];
                    document.getElementById("CalendarStockEndDateSystem_Title").innerHTML = changeMonthNumberToName(month) + " " + year; 
                }
                //========================= Java Script Other ============================//
                function onTextChangeGeneral(sender) {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
                }
                function GetRadWindow() 
                {
                    var oWindow = null;
                    if (window.radWindow)
                        oWindow = window.RadWindow; 
                    else if (window.frameElement.radWindow)
                        oWindow = window.frameElement.radWindow; 
                    return oWindow;
                }
               function CloseWindow() 
               {
                     GetRadWindow().Close();
               }
              </script>
             </telerik:RadCodeBlock>
             <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" >
                   <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="grdInventory">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="grdInventory" LoadingPanelID="RadAjaxLoadingPanel1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                   </AjaxSettings>
             </telerik:RadAjaxManager>
             <div class="moduleContent1000">
              <div class="moduleDivBottom1000">
                 <asp:Panel ID="Panel2" runat="server" CssClass="contentPaneDiv" Height="30px" ScrollBars="Auto" >
                            <table cellpadding="0" cellspacing="0">
                                <tr class="command-list">
                                    <td>
                                        <asp:LinkButton ID="btnSave" runat="server" CssClass="LinkButton"  onclick="btnSave_Click">
                                            <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cmd_Save.gif" />&nbsp;&nbsp;บันทึกข้อมูล
                                        </asp:LinkButton>
                                    </td>
                                    <td class="command-item">
                                        <asp:LinkButton ID="btnCancel" runat="server" CssClass="LinkButton" OnClick="btnCancel_Click">
                                            <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cancel.gif" />&nbsp;&nbsp;ยกเลิกข้อมูล
                                        </asp:LinkButton>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                 </div>
           </div>
           <div class="moduleContent1000">
                  <div class="moduleDivBottom1000">
                     <asp:Panel ID="Panel1" runat="server" CssClass="contentPaneDiv" Height="300px" ScrollBars="Auto" align = "left" >    
                                 <div class="header-grid" align="left">
                                           <asp:Label ID="lblHeaderList" runat="server" Text="รายละเอียดการตรวจนับพัสดุ" ></asp:Label>
                                 </div>
                                 <div class="formList-detail" align="left">
                                               <table>
                                                     <tr>
                                                            <td width="20px"></td>
                                                            <td width ="200px">
                                                                       <asp:Label CssClass="font-label" runat = "server" ID= "lblCheckStockCode" Text = "รหัสการตรวจนับพัสดุ           : " Font-Bold ="true" />
                                                            </td>
                                                            <td>
                                                                       <asp:Label CssClass="font-label" runat = "server" ID= "pCheckStockCode"  Font-Bold ="true" />
                                                            </td>
                                                     </tr>
                                               </table>
                                 </div>
                                 <div class="formList-detail">
                                     <table>
                                         <tr>
                                                <td width="20px"></td>
                                                <td valign="top" width="200px">
                                                    <asp:Label CssClass="font-label" runat = "server" ID= "lblCheckStartDate" Text = "วันที่เริ่มการตรวจนับ           : " Font-Bold="true"/>
                                                    </td>
                                                <td>
                                                    <telerik:RadMaskedTextBox ID="txtCheckStartDate" runat="server" Mask=" ##/##/####" SelectionOnFocus="SelectAll" TextWithLiterals=" //" Width="75px">
                                                    </telerik:RadMaskedTextBox>
                                                </td>
                                                <td width="220px" >
                                                      <asp:LinkButton ID="lbtCheckStartDate" runat="server" CssClass="LinkButton">
                                                            <img alt="" src="../Image/Icon/Calendar.gif" style="border:0px;vertical-align:middle;" />
                                                      </asp:LinkButton>
                                                      <telerik:RadToolTip ID="ToolTipCheckStartDateSystem" runat="server" Animation="None" HideEvent="LeaveToolTip" Position="MiddleRight" ShowEvent="OnClick" Skin="Telerik" 
                                                        TargetControlID="lbtCheckStartDate" Modal="true">
                                                            <telerik:RadCalendar id="CalendarCheckStartDateSystem" runat="server" TitleFormat="MMMM yyyy" EnableMultiSelect="false" UseRowHeadersAsSelectors="false" UseColumnHeadersAsSelectors="false" DayCellToolTipFormat="dddd, dd MMMM, yyyy" NavigationPrevToolTip="เดือนก่อนหน้า" NavigationNextToolTip="เดือนถัดไป" FastNavigationNextToolTip="3 เดือนถัดไป" FastNavigationPrevToolTip="3 เดือนก่อนหน้า">
                                                                <ClientEvents OnDateClick="OnCheckStartDateClick" OnCalendarViewChanged="OnCalendarCheckStartDateViewChanged"></ClientEvents>
                                                                <FastNavigationSettings EnableTodayButtonSelection="true" TodayButtonCaption="ไปที่วันนี้" OkButtonCaption="เปลี่ยน" CancelButtonCaption="ยกเลิก" />
                                                            </telerik:RadCalendar>
                                                      </telerik:RadToolTip>
                                                        &nbsp;<label id="Label3" runat="server"><font color="red">*</font></label>
                                                 </td>
                                                 
                                                 
                                                 <td valign="top" width="150px">
                                                    <asp:Label CssClass="font-label" runat = "server" ID= "lblCheckEndDate" Text = "วันที่สิ้นสุดการตรวจนับ           : " Font-Bold="true"/>
                                                    </td>
                                                <td>
                                                    <telerik:RadMaskedTextBox ID="txtCheckEndDate" runat="server" Mask=" ##/##/####" SelectionOnFocus="SelectAll" TextWithLiterals=" //" Width="75px">
                                                    </telerik:RadMaskedTextBox>
                                                </td>
                                                <td width="220px" >
                                                      <asp:LinkButton ID="lbtCheckEndDate" runat="server" CssClass="LinkButton">
                                                            <img alt="" src="../Image/Icon/Calendar.gif" style="border:0px;vertical-align:middle;" />
                                                      </asp:LinkButton>
                                                      <telerik:RadToolTip ID="ToolTipCheckEndDateSystem" runat="server" Animation="None" HideEvent="LeaveToolTip" Position="MiddleRight" ShowEvent="OnClick" Skin="Telerik" 
                                                        TargetControlID="lbtCheckEndDate" Modal="true">
                                                            <telerik:RadCalendar id="CalendarCheckEndDateSystem" runat="server" TitleFormat="MMMM yyyy" EnableMultiSelect="false" UseRowHeadersAsSelectors="false" UseColumnHeadersAsSelectors="false" DayCellToolTipFormat="dddd, dd MMMM, yyyy" NavigationPrevToolTip="เดือนก่อนหน้า" NavigationNextToolTip="เดือนถัดไป" FastNavigationNextToolTip="3 เดือนถัดไป" FastNavigationPrevToolTip="3 เดือนก่อนหน้า">
                                                                <ClientEvents OnDateClick="OnCheckEndDateClick" OnCalendarViewChanged="OnCalendarCheckEndDateViewChanged"></ClientEvents>
                                                                <FastNavigationSettings EnableTodayButtonSelection="true" TodayButtonCaption="ไปที่วันนี้" OkButtonCaption="เปลี่ยน" CancelButtonCaption="ยกเลิก" />
                                                            </telerik:RadCalendar>
                                                      </telerik:RadToolTip>
                                                 </td>
                                         </tr>
                                     </table>
                               </div>    
                               <div class="formList-detail">
                                           <table>
                                                 <tr>
                                                        <td width="20px"></td>
                                                        <td width ="200px">
                                                                   <asp:Label CssClass="font-label" runat = "server" ID= "lblCheckStockDesc" Text = "รายการตรวจนับพัสดุ           : " Font-Bold ="true" />
                                                        </td>
                                                        <td>
                                                                   <telerik:RadTextBox runat = "server" ID ="txtCheckStockDesc" ToolTip="กรอกรายการตรวจนับพัสดุ"  Width ="700px" />
                                                                   &nbsp;<label id="Label1" runat="server"><font color="red">*</font></label>
                                                                   
                                                        </td>
                                                 </tr>
                                           </table>
                               </div>            
                               <div class="formList-detail">
                                                               <table>
                                                                     <tr>
                                                                            <td width="20px"></td>
                                                                            <td width ="200px" align="left">
                                                                                 <asp:Label CssClass="font-label" runat = "server" ID= "lblOrganize" Text = "หน่วยงาน/คลัง ที่ตรวจนับพัสดุ         : " Font-Bold="true"/>
                                                                            </td>
                                                                            <td>
                                                                                 <asp:RadioButton CssClass="font-label" ID="rbJobSite" AutoPostBack="True" runat="server" Text="สำนัก/กอง/ศูนย์"
                                                                                 GroupName="gbOrganize" Width ="200px" OnCheckedChanged="rbJobSite_CheckedChanged" >
                                                                                 </asp:RadioButton>
                                                                                 <asp:RadioButton CssClass="font-label" ID="rbWarehouse" AutoPostBack="True" runat="server" Text="คลังพัสดุ" 
                                                                                 GroupName="gbOrganize" Width="200px" OnCheckedChanged ="rbWarehouse_CheckedChanged" >
                                                                                 </asp:RadioButton>
                                                                            </td>
                                                                     </tr>
                                                                     <tr>
                                                                            <td width="20px"></td>
                                                                            <td width ="200px" align="left">
                                                                                 <asp:Label CssClass="font-label" runat = "server" ID= "lblJoBSiteSendRepair" Text = "หน่วยงานที่ทำการตรวจนับพัสดุ: " Font-Bold="true"/>
                                                                                 <asp:Label CssClass="font-label" runat = "server" ID= "lblWarehouse" Text = "คลังที่ทำการตรวจนับพัสดุ: " Font-Bold="true"/>
                                                                            </td>
                                                                            <td>
                                                                                 <telerik:RadComboBox ID="cmbJobSite" runat="server" 
                                                                                    AllowCustomText="true" EmptyMessage="< เลือกหน่วยงานที่ทำการส่งซ่อม >" 
                                                                                    EnableLoadOnDemand="true" EnableVirtualScrolling="true" Height="230px" 
                                                                                    HighlightTemplatedItems="true" MarkFirstMatch="false" 
                                                                                    OnClientTextChange="onTextChangeGeneral" 
                                                                                    OnItemsRequested="cmbJobSite_ItemsRequested" 
                                                                                    ShowDropDownOnTextboxClick="true" ShowMoreResultsBox="true" Width="740px">
                                                                                    <HeaderTemplate>
                                                                                        <table cellpadding="0" cellspacing="0" class="font-label">
                                                                                            <tr>
                                                                                                <td align="center" width="200px"><b>รหัสหน่วยงาน</b></td>
                                                                                                <td align="center" width="150px"><b>ชื่อหน่วยงาน</b></td>
                                                                                            </tr>
                                                                                        </table>
                                                                                    </HeaderTemplate>
                                                                                    <ItemTemplate>
                                                                                        <asp:Table ID="tableJoBSite" runat="server" CellPadding="0" 
                                                                                            CellSpacing="0" CssClass="font-label">
                                                                                        </asp:Table>
                                                                                    </ItemTemplate>
                                                                                </telerik:RadComboBox>
                                                                                <telerik:RadComboBox ID="cmbWarehouse" runat="server" 
                                                                                    AllowCustomText="true" EmptyMessage="< เลือกคลังที่ดำเนินการส่งซ่อม >" 
                                                                                    EnableLoadOnDemand="true" EnableVirtualScrolling="true" Height="230px" 
                                                                                    HighlightTemplatedItems="true" MarkFirstMatch="false" 
                                                                                    OnClientTextChange="onTextChangeGeneral" 
                                                                                    OnItemsRequested="cmbWarehouse_ItemsRequested" 
                                                                                    ShowDropDownOnTextboxClick="true" ShowMoreResultsBox="true" Width="740px">
                                                                                    <HeaderTemplate>
                                                                                        <table cellpadding="0" cellspacing="0" class="font-label">
                                                                                            <tr>
                                                                                                <td align="center" width="200px"><b>คลังที่ดำเนินการส่งซ่อม</b></td>
                                                                                                <td align="center" width="150px"><b>รายละเอียดของคลังพัสดุ</b></td>
                                                                                            </tr>
                                                                                        </table>
                                                                                    </HeaderTemplate>
                                                                                    <ItemTemplate>
                                                                                        <asp:Table ID="tableWarehouse" runat="server" CellPadding="0" 
                                                                                            CellSpacing="0" CssClass="font-label">
                                                                                        </asp:Table>
                                                                                    </ItemTemplate>
                                                                                 </telerik:RadComboBox>
                                                                                 &nbsp;<label id="lblWarningOrg" runat="server"><font color="red">*</font></label>
                                                                           </td>      
                                                                     </tr>
                                                               </table>
                               </div>
                               <div class="formList-detail">
                                           <table>
                                                 <tr>
                                                        <td width="20px"></td>
                                                        <td width ="200px"
                                                                   <asp:Label CssClass="font-label" runat = "server" ID= "lblRemark" Text = "หมายเหตุเพิ่มเติม           : " Font-Bold ="true" />
                                                        </td>
                                                        <td>
                                                                   <telerik:RadTextBox CssClass="font-label" runat = "server" ID ="txtRemark" Width="700px" Height="50px" TextMode="MultiLine" />
                                                        </td>
                                                 </tr>
                                           </table>
                               </div>  
                     </asp:Panel>
                  </div>
           </div>                                               
    </form>
</body>
</html>
